
const Vue = require('vue')

const vueServerRender = require('vue-server-renderer')

const createRenderer = vueServerRender.createRenderer;

const fs = require('fs')

const express = require('express')

const nodeServer = express()

const port = 8088

const renderer = createRenderer({

	template: fs.readFileSync('./views/tmp.html','utf-8')
})

const context = {

	title:'hell 123',

}

const app = new Vue({

	template:`<div>我了个去取啊</div>`	

})


nodeServer.get('*',(req,res)=>{

	renderer.renderToString(app,context,(err,html) => {
		if(err) {
			console.log(err)
			return
		}
		console.log('success')
		res.send(html);
	})

})

nodeServer.listen(port)
